package kingiis.utils.trysvg.adapter;

import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import butterknife.ButterKnife;
import butterknife.InjectView;
import kingiis.utils.trysvg.R;

/**
 * Created by King on 2018/1/10 0010.
 */

public class MainAI extends RecyclerView.Adapter<MainAI.MainHolder> {

    private String[] data;

    public MainAI(String[] data) {
        this.data = data;
    }

    @Override
    public MainHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        return new MainHolder(
                LayoutInflater.from(parent.getContext())
                        .inflate(R.layout.item_text, parent, false)
        );
    }

    @Override
    public void onBindViewHolder(MainHolder holder, int position) {
        holder.text.setText(data[position]);
    }

    @Override
    public int getItemCount() {
        return data.length;
    }

    class MainHolder extends RecyclerView.ViewHolder {
        @InjectView(R.id.text_one)
        TextView text;

        public MainHolder(View itemView) {
            super(itemView);
            ButterKnife.inject(this, itemView);
        }
    }
}
